home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Programming
/
HBasicGolded
/
Files
/
Scripts
/
HB_Functions.rexx
< prev
Wrap
OS/2 REXX Batch file
|
2000-01-18
|
2KB
|
88 lines
/* Script to save a dictionary of HBasic OS3 file1 */
/* get the directory path of the images */
PARSE ARG dirname
/* strip extranneous spaces and quotes */
dirname = STRIP(dirname)
dirname = STRIP(dirname,"b",'"')
dirname = STRIP(dirname)
IF RIGHT(dirname,1) ~= "/" & RIGHT(dirname,1) ~=":" then ; dirname=dirname||"/"
/* create a list of BH files in the temporary file in RAM */
commandline = "list >ram:"||tempname||" "dirname"#?.(bh) files LFORMAT %P%S"
ADDRESS COMMAND commandline
ADDRESS COMMAND 'c:Sort RAM:tempname TO RAM:tamlist.temp'
/* Open the file and read in names to filename compound variable */
inname = "ram:tamlist.temp"
q = OPEN("infile", inname, "R")
filecount = 1
do UNTIL EOF("infile")
filename.filecount = READLN("infile")
filecount = filecount+1
end
/* Remember to close and delete the temporary file */
CALL CLOSE("infile")
ADDRESS COMMAND "delete ram:"||tempname
SAY filecount "Files have been found"
/* CREATE OUTPUT FILES */
CALL OPEN(file1, "Ram:Functions", "W")
CALL OPEN(file2, "Ram:Subs", "W")
do loop = 1 to filecount-2 /* MAIN LOOP */
File=filename.loop
CALL WRITELN(FILE1, "/*" File "*/")
CALL WRITELN(FILE2, "/*" File "*/")
LineLength1=0
LineLength2=0
CALL OPEN("Data_File", File, "R")
do UNTIL EOF("Data_File")
Textline = READLN("Data_File")
TYPE = CHECKTYPE(Textline)
IF TYPE="FUNCTION" THEN ; LineLength1 = FileWrite(LineLength1,FILE1)
IF TYPE="SUB" THEN ; LineLength2 = FileWrite(LineLength2,FILE2)
end
CALL WRITELN(FILE1, "");CALL WRITELN(FILE1, "")
CALL WRITELN(FILE2, "");CALL WRITELN(FILE2, "")
CALL CLOSE("Data_File")
end /* END of Main Loop */
/* Close Output Files */
CALL CLOSE(file1)
CALL CLOSE(file2)
EXIT
CHECKTYPE: EXPOSE Header
TYPE = WORD(Textline,2)
Header = WORD(Textline,3)
RETURN TYPE
FILEWRITE: PROCEDURE Expose Header
LineLength = Arg(1)
FILE = Arg(2)
LineLength = LineLength + LENGTH(Header)
IF LineLength > 120 THEN
DO
CALL WRITELN(FILE,"")
LineLength = LENGTH(Header)
END
CALL WRITECH(FILE,Header||" ")
RETURN LineLength